// @Author EthanScriptOn
// @Desc
package config_node

import (
	"gitee.com/fatzeng/srf_switch_basic_components/node"
	"gitee.com/fatzeng/srf_switch_config/config_define"
)

type SourceLoaderNode struct {
	*node.DoublyLinkedNode
	segmentHead config_define.NodeElemType
	segmentSons map[config_define.NodeElemType]struct{}
	content     interface{}
}

func GenerateSourceLoaderNode() *SourceLoaderNode {
	sourceLoaderNode := new(SourceLoaderNode)
	dlList := node.GenerateEmptyDoublyLinkedNode(sourceLoaderNode)
	sourceLoaderNode.DoublyLinkedNode = dlList
	return sourceLoaderNode
}

func (s *SourceLoaderNode) GetParagraphHead() config_define.NodeElemType {
	return s.segmentHead
}

func (s *SourceLoaderNode) SetSegmentHead(segmentHead config_define.NodeElemType) {
	s.segmentHead = segmentHead
}

func (s *SourceLoaderNode) GetSegmentSons() map[config_define.NodeElemType]struct{} {
	return s.segmentSons
}

func (s *SourceLoaderNode) SetSegmentSons(segmentSons map[config_define.NodeElemType]struct{}) {
	s.segmentSons = segmentSons
}

func (s *SourceLoaderNode) AppendSegmentSons(paragraphSon config_define.NodeElemType) {
	s.segmentSons[paragraphSon] = struct{}{}
}

func (s *SourceLoaderNode) GetContent() interface{} {
	return s.content
}

func (s *SourceLoaderNode) SetContent(content interface{}) {
	s.content = content
}
